package org.spring.springboot.exception;

import java.io.Serializable;

import static org.spring.springboot.util.ExpPrefixUtil.*;


/**
 * 全局的异常状态码 和 异常描述
 *
 * PS:异常码一共由5位组成，前两位为固定前缀，请参考{@link com.gaoxi.utils.ExpPrefixUtil}
 */
public enum ExpCodeEnum implements Serializable {

    /** 通用异常 */
    UNKNOW_ERROR(ComExpPrefix + "000", "未知异常"),
    ERROR_404(ComExpPrefix + "001", "没有该接口"),
    PARAM_NULL(ComExpPrefix + "002", "参数为空"),
    NO_REPEAT(ComExpPrefix + "003", "请勿重复提交"),
    SESSION_NULL(ComExpPrefix + "004", "请求头中SessionId不存在"),
    HTTP_REQ_METHOD_ERROR(ComExpPrefix + "005", "HTTP请求方法不正确"),
    JSONERROR(ComExpPrefix + "006", "JSON解析异常"),

    /** User模块异常 */
    USERNAME_NULL(UserExpPrefix + "000", "用户名为空"),
    PASSWD_NULL(UserExpPrefix + "001", "密码为空"),
    AUTH_NULL(UserExpPrefix + "002", "手机、电子邮件、用户名 至少填一个"),
    LOGIN_FAIL(UserExpPrefix + "003", "登录失败"),
    UNLOGIN(UserExpPrefix + "004", "尚未登录"),
    NO_PERMISSION(UserExpPrefix + "005", "没有权限"),
    PHONE_NULL(UserExpPrefix + "006", "手机号为空"),
    MAIL_NULL(UserExpPrefix + "007", "电子邮件为空"),
    USERTYPE_NULL(UserExpPrefix + "008", "用户类别为空"),
    LICENCE_NULL(UserExpPrefix + "009", "营业执照为空"),
    COMPANYNAME_NULL(UserExpPrefix + "010", "企业名称为空"),
    ROLE_NULL(UserExpPrefix + "011", "角色为空"),
    ROLEID_NULL(UserExpPrefix + "012", "roleId为空"),
    MENUIDLIST_NULL(UserExpPrefix + "013", "menuIdList为空"),
    PERMISSIONIDLIST_NULL(UserExpPrefix + "014", "permissionIdList为空"),
    NAME_NULL(UserExpPrefix + "015", "name为空"),
    LOCATIONID_NULL(UserExpPrefix + "016", "locationId为空"),
    LOCATIONUPDATEREQ_NULL(UserExpPrefix + "017", "LocationUpdateReq为空"),
    TOKEN_ERROR(UserExpPrefix + "018", "用户token错误"),
    TOKEN_NULL(UserExpPrefix + "019", "无token，请重新登录"),
    TOKEN_FORBID(UserExpPrefix + "020", "用户没有访问权限，请重新登录"),
    USERID_PASSWORD_ERROR(UserExpPrefix + "021", "用户名或者密码错误"),
    IMPORT_EMPTY(UserExpPrefix + "022", "导入的数据为空"),
    NOT_EXCEL(UserExpPrefix + "023", "不是excel文件"),
    CODE_ERROR(UserExpPrefix + "024","code错误"),
    LOGIN_ERROR(UserExpPrefix + "025","用户名或者密码错误"),
    USERNAME_DUPLICATE(UserExpPrefix + "026","用户名重复"),
    IDNUMBER_DUPLICATE(UserExpPrefix + "027","身份证号已被占用"),
    INSURANCE_DUPLICATE(UserExpPrefix + "028","员工保险不能重复添加"),
    SPECIAL_WORKER_DUPLICATE(UserExpPrefix + "029","特种作业证号不能重复添加"),
    SPECIAL_WORKER_UPDATE_DUPLICATE(UserExpPrefix + "030","特种作业证号已被占用更新失败"),
    SYSUSER__UPDATE_ERROR(UserExpPrefix + "031","系统用户修改信息失败"),
    IMPORT_FILE_ERROR(UserExpPrefix + "032","选择了错误的Excel文件，请仔细核对文件名"),
    BINDING_IDNUMBER_ERROR(UserExpPrefix + "033","绑定失败，该身份证还未录入信息"),
    WX_IDNUMBER_DUPLICATE(UserExpPrefix + "034","绑定失败，该身份证已被绑定！"),
    WORKER_NO_IS_NOT_EXISTENCE(UserExpPrefix + "035","员工号不存在"),
    AUTHORIZATION_NO_IS_NOT_EXISTENCE(UserExpPrefix + "036","授权信息不存在"),
    IMPORT_ELECTRIC_WELDER_CATEGORY_NOT_EXISTENCE(UserExpPrefix + "037","导入电焊工分类不存在"),
    IMPORT_FITTER_CATEGORY_NOT_EXISTENCE(UserExpPrefix + "038","导入装配工分类不存在"),
    HOTEL_DAYS_IS_NOT_ENOUGH(UserExpPrefix + "039", "用户酒店抵用天数不够"),
    SECOND_CHECK_DUPLICATE(UserExpPrefix + "040", "二审不能重复审核或者一审的状态未审核或者已拒绝的单子核状态"),
    FIRST_CHECK_DUPLICATE(UserExpPrefix + "041", "一审不能重复审核或者一审的单子是拒绝状态"),
    FIRST_REJECT_CHECK_DUPLICATE(UserExpPrefix + "042", "一审不能重复拒绝或者一审状态是已审核的单子不能拒绝"),
    SECOND_REJECT_CHECK_DUPLICATE(UserExpPrefix + "043", "二审不能重复拒绝，二审已经审核后不能拒绝或者一审状态是未审核或者已拒绝的单子不能拒绝"),
    CAN_NOT_UPDATE(UserExpPrefix + "044", "用户不能在，一审未审核和一审已审核的情况下做编辑"),
    HOTEL_DAYS_SUBTRACT_ERROR(UserExpPrefix + "045", "用户剩下的间夜数，不能小于退物业抵扣的间夜数"),
    HOTEL_DAYS_SUBTRACT_ERROR_BUILDING(UserExpPrefix + "046", "用户抵扣的间夜数不能大于物业出租获取的old间夜数"),
    USER_JIANYE_ERROR(UserExpPrefix + "047", "用户间夜数交易异常"),
    OPENID_IS_DUPLICATE(UserExpPrefix + "048", "用户注册信息不能重复提交"),



    /** Analysis模块异常 */
    XXXX_NULL(AnlsExpPrefix + "000", "XXXX异常");

    private String code;
    private String message;

    private ExpCodeEnum(String code, String message){
        this.code = code;
        this.message = message;
    }

    ExpCodeEnum(){}

    public String getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}
